#include <iostream>
using namespace std;

class Complex
{
    private:
        float real;
        float imag;

    public:
        Complex(float a=0,float b=0){real=a;imag=b;}
        void print()
        {
            cout<<real;
            if(imag>0)cout<<"+"<<imag<<"i"<<endl;
            else cout<<imag<<"i"<<endl;
        }
        friend Complex operator+ (Complex& a,Complex& b);
        friend Complex operator- (Complex& a,Complex& b);
        friend Complex operator* (Complex& a,Complex& b);
        friend Complex operator/ (Complex& a,Complex& b);
};

Complex operator+(Complex& a,Complex& b)
{
    Complex ans;
    ans.real=a.real+b.real;
    ans.imag=a.imag+b.imag;
    return ans;
}
Complex operator-(Complex& a,Complex& b)
{
    Complex ans;
    ans.real=a.real-b.real;
    ans.imag=a.imag-b.imag;
    return ans;
}
Complex operator*(Complex& a,Complex& b)
{
    Complex ans;
    ans.real=a.real*b.real-a.imag*b.imag;
    ans.imag=a.real*b.imag+b.real*a.imag;
    return ans;
}
Complex operator/(Complex& a,Complex& b)
{
    Complex ans;
    float t=1/(a.real*b.real+a.imag*b.imag);
    ans.real=(a.real*b.real+a.imag*b.imag)*t;
    ans.imag=(b.real*a.imag-a.real*b.imag)*t;
    return ans;
}

int main()
{
    Complex A1(2.3,2.6),A2(1.1,4.4),A3,A4,A5,A6;
    A3 = A1+A2;
    A4 = A1-A2;
    A5 = A1*A2;
    A6 = A1/A2;

    cout<<"A1:";
    A1.print();
    cout<<"A1:";
    A2.print();
    cout<<"A1+A2:";
    A3.print();
    cout<<"A1-A2:";
    A4.print();
    cout<<"A1*A2:";
    A5.print();
    cout<<"A1/A2:";
    A6.print();

    return 0;
}

